<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改</title>
<link rel="stylesheet" href="${ctx }/resources/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="${ctx }/resources/css/public.css" media="all" />
<link rel="stylesheet" type="text/css" href="${ctx }/resources/plugin/css/index.css">
<link rel="stylesheet" href="${ctx }/resources/layui/css/layui.css" media="all">
</head>
<body class="childrenBody">
	<form class="layui-form" action="#" id="frm" method="post" lay-filter="frm">
		<div class="layui-form-item">
    		<label class="layui-form-label">请假单标题</label>
    		<div class="layui-input-block">
      			<input type="hidden" name="state" value="${leaveBill.state }">
				<input type="hidden" name="id" value="${leaveBill.id }">
				<input type="hidden" name="userid" value="${leaveBill.userid }">
      			<input type="text" name="title" id="title" lay-verify="title" 
      			 value="${leaveBill.title }" autocomplete="off" placeholder="请输入标题" class="layui-input">
   			</div>
 		 </div>
 		 
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">请假天数</label>
			<div class="layui-input-inline">
				<input type="text" name="days" id="days" lay-verify="required"
				  value="${leaveBill.days }"  autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">开始时间</label>
			<div class="layui-input-inline">
				<input type="text" name="leavetime" id="leavetime"  
				 value="<fmt:formatDate value="${leaveBill.leavetime }" pattern="yyyy-MM-dd"/>" autocomplete="off" class="layui-input">
			</div>
		</div>
	</div>
 		 
		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">请假单原因</label>
			<div class="layui-input-block">
				<textarea class="layui-textarea" name="content" 
				 lay-verify="content" id="content">${leaveBill.content }</textarea>
			</div>
		</div>
		

		<div class="layui-form-item">
			<div class="layui-input-block" style="text-align: center;">
				<!--lay-submit标记当按钮是一个提交按钮   -->
				<a href="javascript:void(0)" class="layui-btn" lay-submit=""  lay-filter="leaveBillSubmit">提交</a>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
</body>
<script type="text/javascript" src="${ctx }/resources/layui/layui.js"></script>
<script type="text/javascript">
layui.use([ 'form','jquery','layer','laydate' ], function() {
	var form=layui.form;//得到form对象
	var $=layui.jquery;
	var layer = parent.layer === undefined ? layui.layer : parent.layer;
	var laydate=layui.laydate;
	laydate.render({
		elem:'#leavetime'
	})
	
	//添加提交事件
	form.on("submit(leaveBillSubmit)",function(data){
		var params=$("#frm").serialize();
		$.post("${ctx}/leaveBill/updateLeaveBill.action?"+params,function(obj){
			layer.msg(obj.msg);
			parent.tableIns.reload();//刷新表格
			//关闭窗口
			var index=layer.getFrameIndex(window.name);
			layer.close(index);
		}) 
	});
});	

	/* $(document).ready(function () {
       initDeptTree();
    });
	
	function initDeptTree() {
		//加载可用部门
		$.post("${ctx}/dept/loadDeptTree.action?available=1",function(zNodes){
			initSelectTree("pid",zNodes, false);
	        $(".layui-nav-item a").bind("click", function () {
	            if (!$(this).parent().hasClass("layui-nav-itemed") && !$(this).parent().parent().hasClass("layui-nav-child")) {
	                $(".layui-nav-tree").find(".layui-nav-itemed").removeClass("layui-nav-itemed")
	            }
	        })
		})
	} */
	

</script>
</html>